package com.educhains.module.post.service.impl;

import com.educhains.module.post.persist.mybatis.InfloorMapper;
import com.educhains.module.post.persist.mybatis.PostReplyContentMapper;
import com.educhains.module.post.persist.mybatis.PostReplyMapper;
import com.educhains.module.post.service.PostReplyService;
import com.educhains.module.post.vo.Infloor;
import com.educhains.module.post.vo.PostReply;
import com.educhains.module.post.vo.PostReplyContent;
import com.educhains.module.post.vo.PostReplyWithContent;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;


@Service
public class PostReplyServiceImpl implements PostReplyService {

    @Autowired
    private PostReplyMapper postReplyMapper;

    @Autowired
    private PostReplyContentMapper postReplyContentMapper;

    @Autowired
    private InfloorMapper infloorMapper;


    public PostReply selectByPrimaryKey(String replyId) {
        return postReplyMapper.selectByPrimaryKey(replyId);
    }

    public List<PostReplyWithContent> selectPostReplyList(String postId) {
        return  postReplyMapper.selectPostReplyList(postId);
    }

    public List<PostReplyWithContent> showByPage(int start, int end, String postId) {
        return postReplyMapper.showByPage(start, end, postId);
    }

    public int selectPostReplyCount(String postId) {
        return postReplyMapper.selectPostReplyCount(postId);
    }

    public List<PostReplyWithContent> selectPostLocationReplyList(String postId, String LocationReplyId) {
        return postReplyMapper.selectPostLocationReplyList(postId, LocationReplyId);
    }


    public int insertSelective(PostReply record) {
        return postReplyMapper.insertSelective(record);
    }

    public int insertContent(PostReplyContent record) {
        return postReplyContentMapper.insert(record);
    }

    public List<Infloor> selectInfloorByFloorId(String floorId) {
        return infloorMapper.selectInfloorByFloorId(floorId);
    }

    public int insertInfloorSelective(Infloor record) {
        return infloorMapper.insertSelective(record);
    }

    public List<PostReply> getPostReplyListByUserIdWithLimit(String userId, int limit) {
        return postReplyMapper.getPostReplyListByUserIdWithLimit(userId, limit);
    }
}
